home *** CD-ROM | disk | FTP | other *** search
/ Aminet 43 / Aminet 43 (2001)(GTI - Schatztruhe)[!][Jun 2001].iso / Aminet / util / boot / mathlibspatch.lha / ffppatch.doc next >
Text File  |  2001-03-11  |  8KB  |  259 lines

  1. Short:      mathffp.library FPU speedup patch 1.10b
  2. Author:   Jess Sosnoski (at the below address!!!)
  3. Uploader: starblaz@ptdprolog.net
  4. Type:      util/boot
  5. Version:  1.10beta
  6. Requires: kick 2.04+, an 020+
  7. Long:
  8.  
  9. FFPpatch 1.10beta © 1997-1998 Jess Sosnoski
  10.  
  11. DESCRIPTION:
  12. -----------
  13. This is a program that patches some functions of the mathffp.library
  14. to use 68881/2 instructions, thus squeezing out a bit more speed.
  15. (I hope!)
  16.  
  17. Speeded up FPU-using functions are SPDiv, SPMul, SPCeil, SPFloor 
  18.  
  19. This is also the first speedup patch I ever attempted to write! :)
  20.  
  21. Works on an '040 or '060 too! But only uses FPU versions of SPDiv and SPMul.
  22.  
  23. DISCLAIMER:
  24. ----------
  25. Use this program at your own risk!
  26. I assume no responsibility or liability for problem(s) and/or damage(s)
  27. that occur by the use, modification, and/or existence of this product,
  28. and/or its parts in any form.
  29.  
  30.  But if it don't work right, or slows things down, don't be afraid
  31.  to send me email...or even send some email if it makes your system
  32.  outprocess a cray (yeah, right)
  33.  
  34. Anywayz tho...the following functions are patched, and here's the
  35. speed differences I got:
  36.  
  37.  
  38. Not Patched:
  39. ------------
  40. Testing: mathffp.library
  41. loop-count: 700000.
  42. test    time (s)
  43. SPFix     1.44
  44. SPFlt     2.16
  45. SPCmp     5.80
  46. SPTst     5.26
  47. SPAbs     0.62
  48. SPNeg     0.80
  49. SPAdd     3.46
  50. SPSub     3.44
  51. SPMul     6.58
  52. SPDiv     7.30
  53. SPFloor   4.72
  54. SPCeil   10.24
  55.  
  56. Patched:
  57. --------
  58. Testing: mathffp.library
  59. loop-count: 700000.
  60. test    time (s)
  61. SPFix     1.50        Hmmm.....
  62. SPFlt     2.14        Faster
  63. SPCmp     1.88        Faster
  64. SPTst     1.24        Faster
  65. SPAbs     0.64        Same code...hmmm...
  66. SPNeg     0.78        Same code...hmmm...
  67. SPAdd     3.62        hmmm...
  68. SPSub     3.48        hmmm...
  69. SPMul     5.42        Faster
  70. SPDiv     5.58        Faster
  71. SPFloor   4.16        Faster
  72. SPCeil    4.72        Faster
  73.  
  74.  
  75. Hmmm....very interesting.....that's why this patch is a beta :)
  76.  
  77. Your results will likely differ.
  78.  
  79.  
  80. INSTALLATION:
  81. ------------
  82. Copy it to your c: directory or wherever you like.
  83. You can add the line run <>NIL: ffppatch to your startup-sequence, or
  84. user-startup.  You can give it an icon and put it in WBstartup.
  85. You can basically put it anywhere :)
  86. (I have mine a little after setpatch in my startup-sequence)
  87.  
  88. USAGE:
  89. -----
  90. run <>NIL: ffppatch
  91.  
  92. OUTPUT:
  93. ------
  94. None...even though a very kind person showed me how to do it, I was
  95. too lazy to put any in this release...
  96. Although, if you don't have the right versions of the required libraries,
  97. it will exit with a returncode of 20.
  98.  
  99. REMOVAL:
  100. -------
  101. sorry....once it's in...it stays in!
  102. (didn't I hear Al Bundy say that to Peg once...hmmm....)
  103.  
  104. CAVEATS:
  105. -------
  106. This patch is experimental, so, don't expect any miracles.
  107.  
  108. Opens mathffp.library, and never closes it.
  109.  
  110. Also...not a whole hell of a lot of programs use mathffp.library, but those
  111. which do may benefit from a little speedup.
  112. (although some garshneblankers, the akJFIF, akLJPG, and akPNG
  113.  datatypes use it)
  114.  
  115. There exists a 68881 card for 68000 owners, but, as I found out via
  116. email, does not access the FPU in the same way that an 020+ would.
  117. I did not include any special code to support this, so it is likely that
  118. this patch may not do anything at all on that type of setup.
  119.  
  120. NOTES:
  121. -----
  122. mathffp.library is in your Kickstart ROM...you won't find it in libs.
  123.  
  124.  
  125. FFPTEST
  126. -------
  127. Obsolete....mathtest is included now!!! (see history)
  128.  
  129. MATHTEST
  130. --------
  131. A really nice mathffp/mathieeesingbas.library tester which was very
  132. kindly donated to me for inclusion in this distribution.
  133. (see thank you section)
  134.  
  135. usage: mathtest <iterations> FFP/MSB
  136.  
  137. mathtest <iterations> FFP
  138.  
  139. run <>NIL: ffppatch
  140. mathtest <same number you used above> FFP
  141.  
  142. Then you will see a difference.
  143.  
  144. HISTORY:
  145. -------
  146. 1.0    First Release
  147.  
  148. 1.1    Now closes mathffp.library when mathtrans.lib v40 can't be opened
  149.     Optimized spmul, spdiv, spabs, spneg, spflt, spfloor and squeezed
  150.     a couple more clock cycles out.
  151.     (spadd and spsub optimized too, but disabled cuz they were
  152.      slower for some reason :( )
  153.     Removed SPFix patch...it was slower :(
  154.  
  155. 1.2    Due to my rewriting of ffptest (included), I was able to more
  156.     accurately test speed of calls to mathffp.library.
  157.     I found out everything went faster in the first place :)
  158.     Re-enabled everything.
  159.  
  160. 1.3    Contacted Martin Berndt, author of fmath40x.lha, and asked
  161.     about the Fieee and Tieee functions....so, he emailed me the
  162.     source...and I removed the mathtrans.library requirement and
  163.     put the functions directly into the patch program, making it
  164.     faster :)
  165.  
  166. 1.4    Longword aligned all patches.
  167.     Changed spabs, spneg and spflt functions to not use fpu...
  168.     they didn't have to do all that work, and were probably horribly
  169.      slower before.
  170.     (worst case..they're probably the same speed as the stock library now
  171.      ..but, one of them can likely be inlined directly into the
  172.        jumptable in some future version to save a clock cycle or two)
  173.     Changed the SPFieee function to a faster one.
  174.     Changed the SPFix function to something more like the original.
  175.  
  176. 1.5    Inlined the SPFieee function whereever possible shaving off more
  177.     clock cycles.
  178.     Included Dave Jones' optimized SPTst and SPCmp functions!
  179.  
  180. 1.6    Added checks for 040+ processors...disables SPFloor and SPCeil
  181.     patches, which use instructions not available on 040+'s,
  182.     Optimized SpCeil, Fieee, SPCmp/Tst, SPFix.
  183.     Fixed some patching bugs.
  184.     Sourcecode cleaned up a lot.
  185.  
  186. 1.7    FIXED bug made while optimizing spcmp/tst..could cause some REALLY
  187.     bad results.  (That'll teach me to preserve the CCR!)
  188.  
  189. 1.8    Inlined the SPTieee function, shaving off a couple more clock cycles.
  190.  
  191. 1.9    Now checks for my mathffp.library v43 replacement, and doesn't patch
  192.     if installed.
  193.     Fixed a bug in SPCmp that was causing problems with picticon not
  194.     scaling images.
  195.     Speeded up SPFix.
  196.  
  197. 1.10    Replaced FPU version of SPAdd, SPSub, and SPFlt
  198.     with regular 680x0 code, which was faster.
  199.     Overworked SPFieee function.
  200.     SPAbs, and SPNeg are the same as the standard mathffp.library.
  201.     (hehhe...one of them is ANDI.B    #$7F,D0 RTS)
  202.     They're just in there for completeness.
  203.     Replaced testprogram with Gerd Wieczorek's testprogram.
  204.  
  205. FUTURE:
  206. ------
  207. Make this doc file a bit more presentable, and maybe leave it as plain
  208. text without Amigaguide OR HTML just for kicks.
  209.  
  210. Maybe add command line-arguments to turn on/off selected patches.
  211.  
  212. Make the patch exit, instead of hanging around.
  213.  
  214. One word: NitrOS (if this patch turns out to work as I'd like it to)
  215.  
  216. THANKS TO:
  217. ---------
  218. Martin Berndt...for sending me the sourcecode to Tieee and Fieee
  219. functions from his fmath40x mathtrans.library, which helped a lot!
  220.  
  221. Adam "DC1" Polkosnik for ideas, help with sourcecode, and APATCH!
  222.  
  223. Dave "Barc0de" Jones, for help, ideas, optimized functions, and StreamLineOS 2!
  224.  
  225. Iain "ook" Barclay for help, ideas, optimizations, debugging, and opatch!
  226.  
  227. Andreas Kleinert for help with 040 checking code!
  228.  
  229. Gerd Wieczorek for optimizations, and MATHTEST :)
  230.  
  231. Stephan Rupprecht for help with bugfixing, ideas, and an upcoming
  232. loader for a my replacement v43 mathffp.library :)
  233.  
  234. Everyone who sent me emails, praise, and complaints....your input
  235. was greatly appreciated!!!!
  236.  
  237. BUGS:
  238. ----
  239. Hmmm...what would Tom say, ohyeah, um....possibly.
  240.  
  241. AUTHOR:
  242. ------
  243. Jess Sosnoski
  244. 651 Hillside Drive
  245. Mount Carmel, PA 17851-2463
  246. USA
  247.  
  248. starblaz@ptdprolog.net
  249.  
  250. Updates will appear on my webpage before they appear in Aminet's RECENT file.
  251. http://home.ptd.net/~starblaz
  252.  
  253. IRC nick: starblazr
  254. On: galaxynet (amiga channels), dalnet (#miggy1)
  255. pulsarnet (#elitecafe)
  256.  
  257. Emails, gifts, money, food, cigarettes, Amiga4060T's will all be
  258. gladly accepted.
  259.